mv ./java_install.sh /root/java_install.sh
cd /root

wget https://repo.huaweicloud.com/java/jdk/8u201-b09/jdk-8u201-linux-x64.tar.gz

mkdir /opt/java

tar zxvf /root/jdk-8u201-linux-x64.tar.gz -C /opt/java > /dev/null 2>&1
echo '# JAVA-8u181' >> /etc/profile
echo 'JAVA_HOME=/opt/java/jdk1.8.0_201' >> /etc/profile
echo 'JAVA_BIN=/opt/java/jdk1.8.0_201/bin' >> /etc/profile
echo 'PATH=$PATH:$JAVA_BIN' >> /etc/profile
echo 'CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar' >> /etc/profile
echo 'export JAVA_HOME JAVA_BIN PATH CLASSPATH' >> /etc/profile

source /etc/profile

ln -s /opt/java/jdk1.8.0_201/bin/java /usr/bin/java


echo "java is already installed,please open another session to test it "